/**
 * 实现Runnable线程方法
 */
public class RunnableDemo {
    public static void main(String[] args) {
        MyRun m = new MyRun();
        Thread t1 = new Thread(m);
        Thread t2 = new Thread(m);

        t1.setName("线程一");
        t2.setName("线程二");

        t1.start();
        t2.start();

    }

    private static class MyRun implements Runnable{
        @Override
        public void run() {
            Thread thread = Thread.currentThread();
            String name = thread.getName();
            for(int i = 0; i < 100; i++){
                System.out.println(name + i);
            }
        }
    }
}
